//
// Created by hjie on 23-7-24.
//

#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <stack>

void CharMatch()
{
    std::string valid1 = "{[()]}{}[]({})";
    std::string valid2 = "{(]{}}";

    std::stack<char> char_stack;

    std::string content = valid2;
    for (auto i = 0; i < content.size(); i++)
    {
        if (content[i] == '[' || content[i] == '(' || content[i] == '{')
        {
            char_stack.push(content[i]);
        }
        switch (content[i])
        {
            case ']':
            {
                if (char_stack.top() == '[')
                {
                    char_stack.pop();
                }
                else
                {
                    printf("no.\n");
                }
                break;
            }
            case ')':
            {
                if (char_stack.top() == '(')
                {
                    char_stack.pop();
                }
                else
                {
                    printf("no.\n");
                }
                break;
            }
            case '}':
            {
                if (char_stack.top() == '{')
                {
                    char_stack.pop();
                }
                else
                {
                    printf("no.\n");
                }
                break;
            }
            default:
                break;
        }
    }
}

int main()
{
    CharMatch();
    return 0;
}